package Builder;

/**
 * <p>Title main</p>
 *
 * @author YiMing Liu
 * @date 2018/6/11 17:07
 * <p>Description:</p>
 */
public class main {
    public static void main(String[] args) {
        if (args.length != 1) {
            usage();
            System.exit(0);
        }
        if (args[0].equals("text")) {
            TextBuilder textBuilder = new TextBuilder();
            Director director = new Director(textBuilder);
            director.construct();
            String result = textBuilder.getString();
            System.out.println(result);
        } else if (args[0].equals("file")) {
            FileBuilder fileBuilder = new FileBuilder();
            Director director = new Director(fileBuilder);
            director.construct();
            String result = fileBuilder.getResult();
            System.out.println(result);
        }else{
            usage();
            System.exit(0);
        }



    }

    private static void usage() {
        System.out.println("Usage: java Main text");
        System.out.println("Usage: java Main file");
    }
}
